<?php
class tbl_device_log extends AppModel
{
    public $useTable = 'log_device_infos';
    public $useDbConfig = 'fantasy_hero_kr_log';
    public $primaryKey = '_id';

    public function get_device_log($_usn)
    {
        $params = array(
            'conditions' => array(
                'usn' => $_usn
            ),
            'fields' => array(
                'system_memory_size','device_model','os_full','connect_ip','device_name'
            ),
        );

        $data = $this->find('first', $params);

        return $data;
    }

    public function get_device_date_log($_usn,$start_date,$end_date)
    {
        $params = array(
            'conditions' => array(
                'usn' => $_usn,
                'created' => array('$gt' => $start_date, '$lte' => $end_date),
            ),
            'fields' => array(
                '_id','system_memory_size','device_model','os_full','connect_ip','device_name'
            ),
        );

        $data = $this->find('first', $params);

        return $data;
    }
}